<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录</title>
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

    <style>
        /* 全局样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        /* 基础样式 */
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: #f5f7fa;
            color: #333;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }
        
        /* 波浪背景 */
        .wave-bg {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 180px;
            background: linear-gradient(135deg, #165DFF 0%, #3B82F6 50%, #0EA5E9 100%);
            z-index: -1;
            border-radius: 0 0 50% 50% / 30px;
            transform: scale(1.1);
        }
        
        /* 登录卡片 */
        .login-container {
            width: 100%;
            max-width: 400px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            padding: 32px;
            margin: 20px;
            position: relative;
            z-index: 10;
        }
        
        /* 标题样式 */
        .login-title {
            text-align: center;
            font-size: 28px;
            font-weight: bold;
            color: #165DFF;
            margin-bottom: 32px;
            text-shadow: 0 2px 4px rgba(22, 93, 255, 0.1);
        }
        
        /* 表单样式 */
        .login-form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        /* 输入框容器 */
        .input-group {
            position: relative;
            transition: transform 0.3s ease;
        }
        
        .input-group:focus-within {
            transform: scale(1.02);
        }
        
        /* 输入框样式 */
        .input-group input {
            width: 100%;
            padding: 12px 40px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 16px;
            color: #333;
            background-color: white;
            transition: all 0.3s ease;
        }
        
        .input-group input:focus {
            outline: none;
            border-color: #165DFF;
            box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
        }
        
        .input-group input::placeholder {
            color: #999;
        }
        
        /* 输入框图标 */
        .input-icon {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
            font-size: 18px;
        }
        
        /* 自定义图标 */
        .icon-user::before {
            content: '👤';
        }
        
        .icon-lock::before {
            content: '🔒';
        }
        
        /* 登录按钮 */
        .login-button {
            background-color: #165DFF;
            color: white;
            border: none;
            padding: 14px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .login-button:hover {
            background-color: #0d47a1;
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(22, 93, 255, 0.3);
        }
        
        .login-button:active {
            transform: translateY(0);
        }
        
        /* 辅助选项 */
        .helper-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
        }
        
        .remember-me {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            color: #666;
        }
        
        .remember-me input[type="checkbox"] {
            width: 16px;
            height: 16px;
            cursor: pointer;
        }
        
        .register-link {
            color: #165DFF;
            text-decoration: none;
            transition: color 0.3s ease;
        }
        
        .register-link:hover {
            color: #0d47a1;
            text-decoration: underline;
        }
        
        /* 第三方登录 */
        .third-party-login {
            margin-top: 32px;
        }
        
        .divider {
            position: relative;
            height: 1px;
            background-color: #eee;
            margin-bottom: 24px;
        }
        
        .divider-text {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            background-color: white;
            padding: 0 16px;
            color: #999;
            font-size: 14px;
        }
        
        .third-party-buttons {
            display: flex;
            justify-content: center;
            gap: 32px;
        }
        
        .third-party-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #165DFF;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .third-party-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
        }
        
        /* 响应式设计 */
        @media (max-width: 480px) {
            .login-container {
                padding: 24px;
                margin: 16px;
            }
            
            .login-title {
                font-size: 24px;
                margin-bottom: 24px;
            }
            
            .third-party-buttons {
                gap: 24px;
            }
        }
    </style>
</head>
<body>
    <!-- 波浪背景 -->
    <!-- <div class="wave-bg"></div> -->
    
    <!-- 登录卡片 -->
    <div class="login-container">
        <!-- 标题 -->
        <h1 class="login-title">用户登录</h1>
        
        <!-- 登录表单 -->
        <form class="login-form">
            <!-- 用户名输入框 -->
            <div class="input-group">
                <span class="input-icon icon-user"></span>
                <input type="text" class="user_name" placeholder="用户名" required>
            </div>
            
            <!-- 密码输入框 -->
            <div class="input-group">
                <span class="input-icon icon-lock"></span>
                <input type="password" class="password" placeholder="账户密码" required>
            </div>
        
            
            <!-- 登录按钮 -->
            <button type="submit" class="login-button">点击登录</button>
            
            <!-- 辅助选项 -->
            <div class="helper-options">
                <label class="remember-me">
                    <input type="checkbox">
                    <span>下次自动登录</span>
                </label>
                <a href="#" class="register-link">注册账号</a>
            </div>
        </form>
 
    </div>
    
    <!-- 简单的JS交互 -->
    <script>
        // 点击登录
        $('.login-button').click(function(e){
                e.preventDefault();
                // 获取用户名密码登录
                axios({
                    url:'http://192.168.0.30:8000/users/login',
                    method: 'post',
                    data:{
                        user_name:$('.user_name').val(),
                        password:$('.password').val()
                    }
                })
                .then(res=>{
                    console.log(res);
                    // 数据请求成功后的处理
                  
                    // 解构赋值
                    let {code,message,result} = res.data
                    if (code!=0) return alert(message)
                        // 将token和用户信息存储起来
                    localStorage.setItem('token',result.token)
                    localStorage.setItem('userinfo',JSON.stringify(result))
                 
                    
                })
        })
       
        
        // 注册账号点击处理
        document.querySelector('.register-link').addEventListener('click', function(e) {
            e.preventDefault();
            // 假设注册页面在同目录下的register.html
            window.location.href = 'register.html';
        });
    </script>
</body>
</html>